<?php

declare (strict_types=1);
namespace App\Model;

/**
 * @property int $id 
 * @property int $uid 
 * @property int $add 
 * @property string $amount 
 * @property string $before_amount 
 * @property string $currency 
 * @property string $description 
 * @property int $type 
 * @property int $type_suffix 
 * @property string $association 
 * @property int $create_time 
 * @property string $channel 
 * @property string $platform 
 */
class AccountTransaction extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'account_transaction';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $guarded = [];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'integer', 'uid' => 'integer', 'add' => 'integer', 'type' => 'integer', 'type_suffix' => 'integer', 'create_time' => 'integer'];


    public function getAssociationAttribute($value)
    {


        $association = json_decode($value);
        if (empty($association)){
            $association = null;
        }

        return $association;
    }

}